import React from 'react'
import { Modal, Form, Input } from 'antd'
export default function Modals ({ flag, setflag, num }) {
    const onOk = () => {
        setflag(false)
    }
    const closeModal = () => {
        setflag(false)
    }
    return (
        <Modal visible={flag} onOk={onOk} onCancel={closeModal} destroyOnClose={true}>
            <div className='modaildiv'>
                {num === -1 ? <h2>添加</h2> : <h2>更新</h2>}
                <Form>
                    <Form.Item
                        name='name'
                        label="姓名"
                        rules={[
                            {
                                required: true,
                            },
                        ]}
                    >
                        <Input />
                    </Form.Item>
                    <Form.Item name='age' label="年龄"
                        rules={[
                            {
                                required: true,
                            },
                        ]}
                    >
                        <Input />
                    </Form.Item>
                    <Form.Item
                        name='address'
                        label="地址"
                        rules={[
                            {
                                required: true,
                            },
                        ]}
                    >
                        <Input />
                    </Form.Item>
                </Form>
            </div>
        </Modal >
    )
}
